package ce.com.newbluedemo.my;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import ce.com.cenewbluesdk.proxy.BleFactory;
import ce.com.newbluedemo.R;
import ce.com.newbluedemo.k2.TestK2BlueActivity;

/**
 * Created by Administrator on 2016/11/21 0021.
 */
public class SelectDevActivity extends Activity implements View.OnClickListener{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_select_dev);
        findViewById(R.id.k2).setOnClickListener(this);
        findViewById(R.id.k3).setOnClickListener(this);
        findViewById(R.id.k6).setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {

        Intent intent=new Intent(this,MainActivity.class);
        switch (v.getId()){
            case R.id.k2:
                if(BleFactory.getInstance().getK2Proxy().isConnectOK()){
                    startActivity(new Intent(this,TestK2BlueActivity_bast.class));
                    return;
                }

                intent.putExtra("devType",5);//K2的参数是 5

                break;
            case R.id.k3:
                if(BleFactory.getInstance().getK3Proxy().isConnectOK()){
                    startActivity(new Intent(this,TestBlueActivity.class));
                    return;
                }
                intent.putExtra("devType",3);
                break;
            case R.id.k6:
                if(BleFactory.getInstance().getK6Proxy().isConnectOK()){
                    startActivity(new Intent(this,TestK6BlueActivity.class));
                    return;
                }
                intent.putExtra("devType",6);
                break;
        }
        startActivity(intent);

    }
}
